package com.ccut.xunfeiSpringboot.controller;

import com.ccut.xunfeiSpringboot.common.AjaxResult;
import com.ccut.xunfeiSpringboot.dto.AnalyseCapabilityDTO;
import com.ccut.xunfeiSpringboot.dto.UserAnswerAnalyseDTO;
import com.ccut.xunfeiSpringboot.dto.request.CapabilityAnalyseRequest;
import com.ccut.xunfeiSpringboot.dto.request.MultimodalAnalyseRequest;
import com.ccut.xunfeiSpringboot.service.InterviewAnalyseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/analyse")
@Slf4j
public class InterviewAnalyseController {

    @Autowired
    private InterviewAnalyseService interviewAnalyseService;

    @PostMapping("/capability")
    public AjaxResult analyseCapability(@RequestBody CapabilityAnalyseRequest request) throws Exception {
        AnalyseCapabilityDTO analyseCapabilityDTO = interviewAnalyseService.analyseCapability(request);
        return AjaxResult.success(analyseCapabilityDTO);
    }

    @PostMapping("/userAnswer")
    public AjaxResult analyseUserAnswer(@RequestBody MultimodalAnalyseRequest request) throws Exception {
        UserAnswerAnalyseDTO analysis = interviewAnalyseService.analyseUserAnswer(request);
        return AjaxResult.success(analysis);
    }

    @PostMapping("/multimodal")
    public AjaxResult analyseMultimodal(@RequestBody MultimodalAnalyseRequest request) throws Exception {
        String analysis = interviewAnalyseService.analyseMultimodal(request);
        return AjaxResult.success(analysis);
    }
}
